/**
 * Bestpay.com.cn Inc.
 * Copyright (c) 2011-2019 All Rights Reserved.
 */
package com.study.lickingdogweb.config.interceptconfig;

import com.study.lickingdogweb.intercept.LogInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * 日志拦截器配置类
 *
 * @author zhaorongzhang
 * @version Id: InterceptConfig.java, v 0.1 2019/5/16 13:08 zhaorongzhang Exp $$
 */
@Configuration
public class InterceptConfig extends WebMvcConfigurationSupport {

    /**
     * 日志过滤器
     */
    @Autowired
    private LogInterceptor logInterceptor;

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        /**
         * addPathPatterns: 拦截的url
         * excludePathPatterns: 不拦截的url
         */
        registry.addInterceptor(logInterceptor).addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}